/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package edu.upn.sigemfi.rec.be;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Programador
 */
@Entity
@Table(name = "REC_CASTIGO_CREDITO")
@NamedQueries({@NamedQuery(name = "CastigoCredito.findAll", query = "SELECT c FROM CastigoCredito c"), @NamedQuery(name = "CastigoCredito.findByIdCastigocredito", query = "SELECT c FROM CastigoCredito c WHERE c.idCastigocredito = :idCastigocredito"), @NamedQuery(name = "CastigoCredito.findByFechaConcesion", query = "SELECT c FROM CastigoCredito c WHERE c.fechaConcesion = :fechaConcesion"), @NamedQuery(name = "CastigoCredito.findByFechaVencimiento", query = "SELECT c FROM CastigoCredito c WHERE c.fechaVencimiento = :fechaVencimiento"), @NamedQuery(name = "CastigoCredito.findByValorOriginal", query = "SELECT c FROM CastigoCredito c WHERE c.valorOriginal = :valorOriginal"), @NamedQuery(name = "CastigoCredito.findBySaldoDeudor", query = "SELECT c FROM CastigoCredito c WHERE c.saldoDeudor = :saldoDeudor"), @NamedQuery(name = "CastigoCredito.findByProvisiones", query = "SELECT c FROM CastigoCredito c WHERE c.provisiones = :provisiones")})
public class CastigoCredito implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "ID_CASTIGOCREDITO", nullable = false)
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Long idCastigocredito;
    @Column(name = "FECHA_CONCESION")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaConcesion;
    @Column(name = "FECHA_VENCIMIENTO")
    @Temporal(TemporalType.TIMESTAMP)
    private Date fechaVencimiento;
    @Column(name = "VALOR_ORIGINAL", precision = 53)
    private Double valorOriginal;
    @Column(name = "SALDO_DEUDOR", precision = 53)
    private Double saldoDeudor;
    @Column(name = "PROVISIONES", length = 50)
    private String provisiones;
    @JoinColumns({@JoinColumn(name = "FID_REC_CARTERA", referencedColumnName = "ID_CARTERA"), @JoinColumn(name = "FID_REC_CREDITO", referencedColumnName = "ID_CREDITO")})
    @ManyToOne(fetch = FetchType.LAZY)
    private CreditoCartera creditoCartera;

    public CastigoCredito() {
    }

    public CastigoCredito(Long idCastigocredito) {
        this.idCastigocredito = idCastigocredito;
    }

    public Long getIdCastigocredito() {
        return idCastigocredito;
    }

    public void setIdCastigocredito(Long idCastigocredito) {
        this.idCastigocredito = idCastigocredito;
    }

    public Date getFechaConcesion() {
        return fechaConcesion;
    }

    public void setFechaConcesion(Date fechaConcesion) {
        this.fechaConcesion = fechaConcesion;
    }

    public Date getFechaVencimiento() {
        return fechaVencimiento;
    }

    public void setFechaVencimiento(Date fechaVencimiento) {
        this.fechaVencimiento = fechaVencimiento;
    }

    public Double getValorOriginal() {
        return valorOriginal;
    }

    public void setValorOriginal(Double valorOriginal) {
        this.valorOriginal = valorOriginal;
    }

    public Double getSaldoDeudor() {
        return saldoDeudor;
    }

    public void setSaldoDeudor(Double saldoDeudor) {
        this.saldoDeudor = saldoDeudor;
    }

    public String getProvisiones() {
        return provisiones;
    }

    public void setProvisiones(String provisiones) {
        this.provisiones = provisiones;
    }

    public CreditoCartera getCreditoCartera() {
        return creditoCartera;
    }

    public void setCreditoCartera(CreditoCartera creditoCartera) {
        this.creditoCartera = creditoCartera;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idCastigocredito != null ? idCastigocredito.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof CastigoCredito)) {
            return false;
        }
        CastigoCredito other = (CastigoCredito) object;
        if ((this.idCastigocredito == null && other.idCastigocredito != null) || (this.idCastigocredito != null && !this.idCastigocredito.equals(other.idCastigocredito))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "edu.upn.sigemfi.rec.be.CastigoCredito[idCastigocredito=" + idCastigocredito + "]";
    }

}
